package hive;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class HiveClent {

    private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";

    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        org.apache.hive.jdbc.HiveDriver j;
        // Register driver and create driver instance
        Class.forName(driverName);
        // get connection
        Connection con = DriverManager.
            getConnection("jdbc:hive://120.55.54.181:10000/default", "", "");
        Statement stmt = con.createStatement();
        stmt.executeQuery("create  DATABASE userdb");
        System.out.println("create userdb database successful.");
        con.close();
    }
}
